extends menu
block nav
    ul(class="nav navbar-nav")
        li <a href="/Project/Dashboard/#{Project.ProjectId}"><i class="fa fa-dashboard fa-fw"></i>概览</a>
        li(class="active") <a href="/Task/#{Project.ProjectId}"><i class="fa fa-tasks fa-fw"></i>任务</a>
        li <a href="/Team/#{Project.ProjectId}"><i class="fa fa-users fa-fw"></i>团队</a>
        li <a href="#"><i class="fa fa-cogs fa-fw"></i>设置【#{Project.ProjectName}】</a>
block append content
    div(class="container-fluid" ng-controller="TaskListCtrl" ng-init="NewTask.ProjectId=#{Project.ProjectId};NewTask.AssignTo=#{User.UserId};NewTask.AssignUser='#{User.Nick}';Search.AssignTo=#{User.UserId};Search.AssignToUser='#{User.Nick}';GetTags();GetMemberInProject();Query();")
        div(class="alert alert-success" ng-show="NewTaskCreated") 新任务创建成功!
        div(class="panel panel-info")
            div(class="panel-heading")
                form(class="form-inline" role="form")
                    div(class="form-group")
                        button(data-toggle="collapse" data-target="#newTask" class="btn btn-info") <i class="fa fa-plus fa-fw"></i>新任务
                    div(class="form-group")
                        div(class="btn-group")
                            button(type="button" class="btn btn-default" ng-model="Search.Low" btn-checkbox) 低
                            button(type="button" class="btn btn-default" ng-model="Search.Normal" btn-checkbox) 中
                            button(type="button" class="btn btn-default" ng-model="Search.High" btn-checkbox) 高
                    div(class="form-group")
                        div(class="btn-group")
                            button(type="button" class="btn btn-default" ng-model="Search.New" btn-checkbox) 新创建
                            button(type="button" class="btn btn-default" ng-model="Search.InProgress" btn-checkbox) 进行中
                            button(type="button" class="btn btn-default" ng-model="Search.Completed" btn-checkbox) 已完成
                            button(type="button" class="btn btn-default" ng-model="Search.Canceled" btn-checkbox) 已取消
                    div(class="form-group")
                        div(class="dropdown")
                            button(type="button" class="btn btn-default dropdown-toggle") {{Search.AssignToUser}}<span class="caret"></span>
                            ul(class="dropdown-menu")
                                li
                                    a(href="#" ng-click="Search.AssignTo=null;Search.AssignToUser='全部人员'") 全部人员
                                li(ng-repeat="Member in MemberList")
                                    a(href="#" ng-click="Search.AssignTo=Member.UserId;Search.AssignToUser=Member.Nick") {{Member.Nick}}
                    div(class="form-group")
                        div(class="dropdown")
                            button(type="button" class="btn btn-default dropdown-toggle") {{Search.TagName}}<span class="caret"></span>
                            ul(class="dropdown-menu")
                                li
                                    a(href="#" ng-click="Search.TagId=null;Search.TagName='全部标签'") 全部标签
                                li(ng-repeat="Tag in Tags")
                                    a(href="#" ng-click="Search.TagId=Tag.TagId;Search.TagName=Tag.TagName") {{Tag.TagName}}
                    div(class="form-group")
                        input(type="text" ng-model="Search.Keyword" class="form-control" placeholder="任务标题/任务编号")
                        button(type="button" class="btn btn-info" ng-click="Query()")<i class="fa fa-search fa-fw"></i>查询
            ul(class="list-group")
                div(id="newTask" class="collapse")
                    div(class="panel-body bg-warning")
                        form(role="form" novalidate name="NewTaskForm")
                            div(class="form-group")
                                label 任务标题 *
                                input(type="text" ng-model="NewTask.TaskName" name="TaskName" class="form-control" placeholder="请输入任务标题" required)
                                div(ng-show="NewTaskForm.TaskName.$dirty&&NewTaskForm.TaskName.$error.required" class="text-danger") 请输入任务标题
                            div(class="form-group")
                                label 截止日期 *
                                p(class="input-group")
                                    input(type="text" class="form-control" show-weeks="false" starting-day="1" current-text="今天" toggle-weeks-text="周" clear-text="清空" close-text="关闭" datepicker-popup="yyyy-MM-dd" ng-model="NewTask.DeadLine" required)
                                    span(class="input-group-btn") <button class="btn btn-default"><i class="glyphicon glyphicon-calendar"></i></button>
                            div(class="form-group")
                                label 优先级
                                p
                                    div(class="btn-group")
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Priority" btn-radio="1") 低
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Priority" btn-radio="2") 中
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Priority" btn-radio="3") 高
                            div(class="form-group")
                                label 状态
                                p
                                    div(class="btn-group")
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Status" btn-radio="1") 新创建
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Status" btn-radio="2") 进行中
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Status" btn-radio="3") 已完成
                                        button(type="button" class="btn btn-sm btn-default" ng-model="NewTask.Status" btn-radio="4") 已取消
                            div(class="form-group")
                                label 标签
                                p
                                    div(class="btn-group")
                                        button(type="button" class="btn btn-sm btn-default" ng-repeat="Tag in Tags" ng-model="NewTask.Tags[$index].Checked" btn-checkbox) {{Tag.TagName}}
                            div(class="form-group")
                                label 指派给
                                div(class="dropdown")
                                    button(type="button" class="btn btn-sm btn-default dropdown-toggle") {{NewTask.AssignUser}}<span class="caret"></span>
                                    ul(class="dropdown-menu")
                                        li(ng-repeat="Member in MemberList")
                                            a(href="#" ng-click="NewTask.AssignTo=Member.UserId;NewTask.AssignUser=Member.Nick") {{Member.Nick}}
                            div(class="form-group")
                                label 任务描述
                                div(id="editor" class="bg-info")
                            button(type="button" class="btn btn-info" ng-disabled="NewTaskForm.$invalid" ng-click="CreateNewTask()") 创建
                div(ng-show="TaskList.length<=0" class="list-group-item")
                    div(class="alert alert-success text-center")
                        h1 未找到任何任务<i class="fa fa-smile-o"></i>
                a(class="list-group-item" ng-style="{'text-decoration':(Task.Status==3||Task.Status==4)?'line-through':''}" ng-repeat-start="Task in TaskList" href="#Task{{Task.TaskId}}" data-toggle="collapse" data-parent="#accordion")
                    span(class="label" ng-switch on="Task.Priority")
                        span(class="label label-default" ng-switch-when="1") 低
                        span(class="label label-info" ng-switch-when="2") 中
                        span(class="label label-danger" ng-switch-when="3") 高
                    span(class="label" ng-switch on="Task.Status")
                        span(class="label label-warning" ng-switch-when="1") 新创建
                        span(class="label label-info" ng-switch-when="2") 进行中
                        span(class="label label-success" ng-switch-when="3") 已完成
                        span(class="label label-default" ng-switch-when="4") 已取消
                    span(class="label" ng-show="Task.DeadLine!=null")
                        span(class="label label-info") <i class="fa fa-clock-o fa-fw"></i> {{Task.DeadLine | date:'yyyy-MM-dd'}}
                    span(class="label" ng-repeat="Tag in Task.TagNames.split(',')")
                        span(class="label label-primary") {{Tag}}
                    <span class="text-primary"> {{'#'+Task.TaskId}} &nbsp;{{Task.TaskName}}</span>
                    <span><i class="fa fa-hand-o-right fa-fw"></i>{{Task.AssignToUser}}</span>
                div(id="Task{{Task.TaskId}}" class="panel-collapse collapse" ng-repeat-end)
                    div(class="panel-body bg-warning")
                        div(class="row")
                            div(class="col-sm-6")
                                p(ng-bind-html="Task.Description")
                            div(class="col-sm-6")
                                | 历史记录
                        hr
                        div
                            a(class="btn btn-info" href="/Task/Detail/{{Task.ProjectId}}/{{Task.TaskId}}" ) 编辑
                div(class="text-center")
                    <pagination boundary-links="true" on-select-page="Search.PageNo=page;Query();" total-items="Search.RowCount" items-per-page="Search.PageSize" page="Search.PageNo" max-size="10" class="pagination-sm" previous-text="&lsaquo;" next-text="&rsaquo;" first-text="&laquo;" last-text="&raquo;"></pagination>